home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / tools / cie.lha / cie / minibuffer-yank.el < prev    next >
Lisp/Scheme  |  1993-06-21  |  2KB  |  46 lines

  1. ;;; minibuffer-yank.el
  2.  
  3. ;;; Use this to yank the default or typical response into the minibuffer.
  4. ;;; In CIE, this is used to yank the default tag into the buffer.  So, for
  5. ;;; example, you could type the "Class_Name::" and then C-c C-y to pull in
  6. ;;; the default which contained the unscoped tag.  Or you could yank in the
  7. ;;; tag and edit it.  And so on.  It can also be used for many other things.
  8. ;;; By default it yanks in the current buffer file name (very convenient).
  9.  
  10. ;;; Copyright (C) 1993, Intellection Inc.
  11. ;;;
  12. ;;; Author: Walt Buehring
  13. ;;;
  14. ;;; This program is free software; you can redistribute it and/or modify
  15. ;;; it under the terms of the GNU General Public License as published by
  16. ;;; the Free Software Foundation; either version 1, or (at your option)
  17. ;;; any later version.
  18. ;;;
  19. ;;; This program is distributed in the hope that it will be useful,
  20. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22. ;;; GNU General Public License for more details.
  23. ;;;
  24. ;;; A copy of the GNU General Public License can be obtained from the
  25. ;;; Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26.  
  27.  
  28. ;;; Minibuffer Yank
  29.  
  30. (defvar minibuffer-yank-string nil
  31.   "Bound by commands to specify string yanked by \"minibuffer-yank\" instead
  32. of the buffer file name.")
  33.  
  34. (defun minibuffer-yank ()
  35.   "Insert the value of 'minibuffer-yank-string' if non-nil, else the
  36. filename of the buffer which invoked the minibuffer command."
  37.   (interactive)
  38.   ;; Use the previous buffer on the buffer list and ensure it has a 
  39.   ;; filename associated with it.
  40.   (if minibuffer-yank-string
  41.       (insert minibuffer-yank-string)
  42.     (and (cdr (buffer-list))
  43.      (let ((f (buffer-file-name (car (cdr (buffer-list))))))
  44.        (and f
  45.         (insert (file-name-nondirectory f)))))))
  46.